package org.springblade.modules.admin.vo;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.modules.admin.dto.WatermarkContentDTO;
import org.springblade.modules.admin.enums.WatermarkTypeEnum;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * @Date 15:04 2023/10/25
 * @Description {
 *   水印图片分页展示数据
 * }
 * @Author lsay
 **/
@Data
public class WatermarkImgPageVO {

	private Long id;

	/**
	 * 项目id
	 */
	@ApiModelProperty(value = "项目id")
	private Long buildingId;
	/**
	 * 项目名称
	 */
	@ApiModelProperty(value = "项目名称")
	private String buildingName;
	/**
	 * 电梯id
	 */
	@ApiModelProperty(value = "电梯id")
	private Long elevatorId;
	/**
	 * 电梯地址
	 */
	@ApiModelProperty(value = "电梯地址")
	private String elevatorAddress;
	/**
	 * 计划任务id
	 */
	@ApiModelProperty(value = "计划任务id")
	private Long planId;
	/**
	 * 部件id
	 */
	@ApiModelProperty(value = "部件id")
	private Long partsId;
	/**
	 * 用户id
	 */
	@ApiModelProperty(value = "用户id")
	private Long userId;
	/**
	 * 用户名称
	 */
	@ApiModelProperty(value = "用户名称")
	private String userName;
	/**
	 * 水印类型
	 */
	@ApiModelProperty(value = "水印类型")
	private Integer watermarkType;
	/**
	 * 部分业务标签
	 */
	@ApiModelProperty(value = "部分业务标签")
	private Integer itemType;
	/**
	 * 照片id
	 */
	@ApiModelProperty(value = "照片id")
	private String imgId;
	/**
	 * 照片时间
	 */
	@ApiModelProperty(value = "照片时间")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date imgTime;
	/**
	 * 照片上传地址
	 */
	@ApiModelProperty(value = "照片上传地址")
	private String imgUploadAddress;
	/**
	 * 水印内容
	 */
	@ApiModelProperty(value = "水印内容")
	@TableField(typeHandler = JacksonTypeHandler.class)
	private WatermarkContentDTO watermarkData;
	/**
	 * 照片url
	 */
	@ApiModelProperty(value = "照片url")
	private String imgUrl;

	private String watermarkTypeName;

	private String itemTypeName;

	public void setItemType(Integer itemType) {
		this.itemType = itemType;
		if(ObjectUtil.isNotEmpty(itemType)){
			this.itemTypeName = "离线签到";
		}
	}

	public void setWatermarkType(Integer watermarkType) {
		this.watermarkType = watermarkType;
		if(ObjectUtil.isNotEmpty(watermarkType)){
			this.watermarkTypeName = WatermarkTypeEnum.getName(watermarkType);
		}
	}
}
